import React from 'react'
import { connect } from 'react-redux'
import { addAction } from '@/store/createActions/user'
import Header from '@/component/Header/Header'

class App extends React.Component {
  render() {
    const { state, addCount } = this.props
    return (
      <div>
        <Header title="公园" left="search" right={true} />
        {state.name}
        <button onClick={addCount}>+1</button>
      </div>
    )
  }
}

const mapStateToProps = state => {
  return {
    state: state.User,
  }
}

const mapDispatchToProps = dispatch => {
  return {
    addCount() {
      dispatch(addAction())
    },
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(App)
